var app = getApp()
Page({


  data: { 
    all: [],
    my: [],
    taskStateImage: [
      '../../resource/index-undone.png',
      
    ],

    task: [
   
    ],
    course:{
      "cid": "",
      "num": "",
      "cname": "",
      "video": "",
      "vtype":"",
      "islock": ""
    }
  },
  toAnswer: function (data) {
    var index = data.currentTarget.dataset.index
    this.data.tempIndex = index
      wx.navigateTo({ url: '../answer/answer?taskinfo=' + JSON.stringify(this.data.task[index])+'&answerType=1' })

  },
  getList: function (rd) {

    var that = this
   wx.showLoading({
      title: '请稍候',
    })
    wx.request({
      url: 'https://xiaochengxu.fincoder.com/index.php/Home/Index/elective_detail/',
      data: {
        session3rd: rd,
        cid: that.data.cid
      },
      header: {
        'content-type': 'application/json'
      },
      success: function (res) {
           wx.hideLoading()
        console.log(res)
        that.setData({
          
          task: res.data.task,
          course: res.data.course,

   
        })
      }
    })
  },
  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {
    console.log(options)
    this.setData({
      cid: options.cid,
    })
  
    app.get3rd(this.getList)
  },


})